import { resolve } from "path";
import { defineConfig } from "vite";
import { crx } from "@crxjs/vite-plugin";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import manifest from "./public/manifest.json";

export default defineConfig({
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
      "@/lib": resolve(__dirname, "src/lib"),
    },
  },
  plugins: [
    react({
      jsxRuntime: "automatic",
    }),
    tailwindcss(),
    crx({ manifest }),
  ],
  build: {
    outDir: "dist",
    rollupOptions: {
      input: {
        main: resolve(__dirname, "public/index.html"),
      },
    },
  },
});
